<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>[|.pageTitle|]</title>
    [|if .zTree|]
    <link rel="stylesheet" href="/static/zTree3/css/demo.css?t=5" type="text/css">
    <link rel="stylesheet" href="/static/zTree3/css/zTreeStyle/zTreeStyle.css" type="text/css">
    [|end|]
    <meta charset="utf-8">
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/css/main.css">
    <script src="/static/layui/layui.js?s=36"></script>
    <script src="/static/js/main.js?s=2124"></script>
</head>
<body>
<div class="layui-layout layui-layout-admin" style="padding-left: 40px;margin-top: 20px;">
<form class="layui-form" >
    <div class="layui-form-item">
        <label class="layui-form-label" style="display:inline-block;width:100px;">至尊VIP：</label>
         <div class="layui-form-mid ">
           [|.LVSIGN|],[|.UserNickName|]
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label" style="display:inline-block;width:100px;">代理平台：</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input" id="pathform" value="[|.vipPlatform|]" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label"  style="display:inline-block;width:100px;">添加时间：</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input" id="writetime" value="[|.writedatetime|]" readonly>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label" style="display:inline-block;width:100px;">分类：</label>
        <div class="layui-input-inline" style="width:120px;">
            <select name="userclasscondition" id = "userclasscondition" readonly >
            </select>
        </div> 
    </div>
    
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="onputinsure">确定修改</button>
            <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="returlist">返回至尊VIP列表</button>
        </div>
    </div>
</form>
</div>

<script>
    var $;

    layui.config({
            base : "js/"
    }).use(['form','element','layer','jquery'], function(){
        var element = layui.element;
        var form = layui.form;
        $ = layui.jquery;
    //监听表格复选框选择
   // table.on('checkbox(demo)', function(obj){
    //   console.log(obj);
   // });

    //监听工具条
    ShowSelectData();
    form.render("select");
    form.on('submit(onputinsure)', function(data) {
        
        var selObj = document.getElementById("userclasscondition");
        var dpathform = document.getElementById("pathform");
        if([|.LVSIGN|] ==selObj.value && [|.vipPlatform|] == dpathform.value)
        {
            layer.alert("未做任何修改！", {
                    title: '失败'
            }) 
            return false
        }
   
        layer.confirm('您确定要把【'+ [|.UserNickName|]+'】至尊vip等级从【'+ [|.LVSIGN|]+'】修改为【' + selObj.value+'】吗？' , function(index){
            var jsData = {
                'USER_ID':[|.UserID|]
                ,'CUR_LVSIGN':[|.LVSIGN|]
                ,'MODFY_LVSIGN':selObj.value
                ,'MODFY_VIP_Platform':dpathform.value
                ,'CUR_VIP_Platform':[|.vipPlatform|] 
                }
            $.post('[|urlfor "ExtremevipManageController.ModifyVipInfo"|]', jsData, function (out) {
                if (out.status == 0) {
                    layer.alert(out.message, {icon: 1},function(index){
                        //window.location.href="/sysroomconf/bloodcontrl.html?ServerID="+selObj.value
                        window.location.reload();

                    });
                } else {
                    layer.msg(out.message)
                }
            }, "json");
              
            // layer.alert(JSON.stringify(jsData), {
              //      title: '最终的提交信息'
              // }) 
       
        });
        return false;
    });
    form.on('submit(returlist)', function(data) {
        window.location.href="/extremevipmanage/extermevipuserlist.html"
        return false
    });

}); 
function ShowSelectData(){
 
    var selObj = document.getElementById("userclasscondition");
    //var valObj = document.getElementById("val");
    //var texObj = document.getElementById("tex");
    // 关键是这几句
    var myData = ["--请选择--","一类","二类"]
    var curvalue = [|.LVSIGN|] 
    for ( var i = 0 ; i < myData.length;i ++)
    {
        var Option = document.createElement("option");
        Option.value = i
        if(curvalue == i){
     
             Option.selected="selected";
        }

        Option.text =myData[i];
        selObj.options.add(Option);
    }
}
</script>
</body>
</html>